package com.atguigu.tingshu.album.config;

import com.qcloud.vod.VodUploadClient;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.vod.v20180717.VodClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class VodConfig {

    @Autowired
    private VodConstantProperties vodConstantProperties;

    @Bean
    public VodUploadClient vodUploadClient() {
        return new VodUploadClient(vodConstantProperties.getSecretId(),
                vodConstantProperties.getSecretKey());
    }

    @Bean
    public VodClient vodClient() {
        Credential credential = new Credential(vodConstantProperties.getSecretId(),
                vodConstantProperties.getSecretKey());
        return new VodClient(credential, vodConstantProperties.getRegion());
    }
}
